//
//  ELMacro.h
//  jobClient
//
//  Created by 一览ios on 16/4/1.
//  Copyright © 2016年 YL1001. All rights reserved.
//

#ifndef ELMacro_h
#define ELMacro_h

typedef NS_ENUM(NSInteger,ENTRANCE)//入口
{
    DEFAULT,
    POSITION,//通过职位跳转进来
};

//RGB转UIColor（不带alpha值）
#define UIColorFromRGB(rgbValue) [UIColor  colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0  green:((float)((rgbValue & 0xFF00) >> 8))/255.0  blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define Color(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
//青色
#define  Color1         [UIColor colorWithRed:68.0/255.0 green:154.0/255.0 blue:201.0/255.0 alpha:1.0]
//粉色
#define  Color2         [UIColor colorWithRed:240.0/255.0 green:77.0/255.0 blue:72.0/255.0 alpha:1.0]
//紫色
#define  Color3         [UIColor colorWithRed:65.0/255.0 green:48.0/255.0 blue:86.0/255.0 alpha:1.0]

#define  Color4         [UIColor colorWithRed:68.0/255.0 green:154.0/255.0 blue:201.0/255.0 alpha:1.0]
#define  Color5         [UIColor colorWithRed:240.0/255.0 green:77.0/255.0 blue:72.0/255.0 alpha:1.0]
#define  Color6         [UIColor colorWithRed:65.0/255.0 green:48.0/255.0 blue:86.0/255.0 alpha:1.0]
#define  WhiteColor     [UIColor whiteColor]

#define  ELImageName(a)     [UIImage imageNamed:a]

#define  ELDefaultImage     [UIImage imageNamed:@"audio_person_default_big"]

#define  ELDefaultAvaterImage     [UIImage imageNamed:@"me_center_defaultAvater"]

//获取屏幕宽度和高度
#define ScreenWidth               [UIScreen mainScreen].bounds.size.width
#define ScreenHeight              [UIScreen mainScreen].bounds.size.height
#define SCREEN_SCALE [UIScreen mainScreen].bounds.size.width / 375.0

//#define iphoneX ([UIScreen mainScreen].bounds.size.height == 812.0 && [UIScreen mainScreen].bounds.size.width == 375.0)
#define iphoneX ([[UIApplication sharedApplication] statusBarFrame].size.height > 20 ? YES : NO)

//#define StatusBarHeight           (iphoneX ? 44 : 20)
//#define NavBarHeight              (iphoneX ? 88 : 64)
//#define ToolBarHeight             (iphoneX ? 83 : 49)
//#define BottomSafeHeight          (iphoneX ? 34 : 0)
#define StatusBarHeight           44
#define NavBarHeight              88
#define ToolBarHeight             83
#define BottomSafeHeight          34


/*
 // iPhone X
 #define  EL_iPhoneX (ScreenWidth == 375.f && ScreenHeight == 812.f ? YES : NO)
 // Status bar height.
 #define  EL_StatusBarHeight      (EL_iPhoneX ? 44.f : 20.f)
 // Navigation bar height.
 #define  EL_NavigationBarHeight  44.f
 // Tabbar height.
 #define  EL_TabbarHeight         (EL_iPhoneX ? (49.f+34.f) : 49.f)
 // Tabbar safe bottom margin.
 #define  EL_TabbarSafeBottomMargin         (EL_iPhoneX ? 34.f : 0.f)
 // Status bar & navigation bar height.
 #define  EL_StatusBarAndNavigationBarHeight  (EL_iPhoneX ? 88.f : 64.f)
 */

#define EL_ViewSafeAreInsets(view) ({UIEdgeInsets insets; if(@available(iOS 11.0, *)) {insets = view.safeAreaInsets;} else {insets = UIEdgeInsetsZero;} insets;})

#define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)]?CGSizeEqualToSize(CGSizeMake(1024*2,768*2),[[UIScreen mainScreen] currentMode].size):NO)


#define WS(weakSelf)              __weak __typeof(self)weakSelf = self;
#define SS(strongSelf)            __block __typeof(self)strongSelf = self;
#define SW(strongSelf)            __strong __typeof(weakSelf)strongSelf = weakSelf;

#define ChooseResume_Null_DefaultValue      @"请选择"
#define WriteResume_Null_DefaultValue       @"请填写"
#define GPS_Place_Loading                   @"     正在获取您的当前位置..."
#define NoNetworkMsg                        @"网络状态异常,请检测网络或等待修复后重试"

#define kNotificationAddSameTrade @"kNotificationAddSameTrade"

#pragma mark - 输出
#if DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"\nfunction:%s line:%d content:%s\n", __FUNCTION__, __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);

#else
#define NSLog(FORMAT, ...) nil
#endif


#define EL_TipsLoadingText @"正在加载..."

//分页参数
#define pageParams  @"20"
#define EL_ResponseDataPageSize @"20"

// 本地缓存策略
#define EL_LocalCacheMode 0

// 请求超时时间
#define EL_RequestTimeout 15

// Alert自动消失时间
#define EL_AlertAutoDismissTime 2

//webView拦截AJAX请求
#define CocoaJSHandler          @"mpajaxhandler"

// 加解密Key
#define ELEncryptKey    @"20181008key"

//一览小助手Id
#define YLHelperId      @"15476338"
#define YHelperName     @"一览职业小助手"
//业问小助手Id
#define YWHelperId      @"21227091"

// 意见反馈
#define YLFeedbackPid   @"8881505295534925"


// 高德地图key
//#define ELAMapKey @"afbb450014c2096bf61e4140b956188c"
//#define ELBetaAMapKey @"050ef1194d47e8720730d2d1ab0ab976"
#define ELAMapKey @""
#define ELBetaAMapKey @""


/*******************<上线注意事项>***************************
 * 1.更改版本号。
 * 2.更改生产环境
 * 3.更改Build Configuration  Deubg->Release
 * 4.增加64位指令集
 * 5.开启听云
 * 6.更改极光key 可不用改
 * 7.ELWebSocketManager.m  修改app_tun
 * 8.code signing identity签名证书,provisioning profile配置文件,clear清除缓存，build编译，archive打包，validate验证，submit提交，等待uploading完成，提交审核。
 **********************************************/

//以下这3项是每次发布版本都需要修改
//#define SeviceURL  @"https://api.job1001.com/webservice/index.php?gtype=http"        //外网服务器地址,120.132.146.118测试服务器地址, api.job1001.com正式服务器地址
//





// 开发调试
#define PATH_IDE 0  // 0=生产环境 , 1=test测试 , 2=pre预发布, 3=自定义（本地）
#define PATH_IDE_LOCAL @"http://120.132.146.118/webservice/index.php?gtype=http" // 本地测试域名 valid: PATH_IDE=3
// 接口域名路径
#define PATH_RECOMMEND   @"api-recommend"     // 中台推荐new
#define PATH_OCCUPATION  @"api-occupation"    // 微服务框架
#define PATH_OPERATION   @"api-operation"     // 运营中台
#define PATH_YP          @"api-yp"            // 云聘
#define PATH_CAREER      @"api-career"        // 职业报告
#define PATH_STATISTICS  @"api-statistics"    // AI面评

#ifdef DEBUG

//测试环境
//#define SeviceURL  @"http://120.132.146.117/webservice/index.php?gtype=http"
//#define NewSeviceURL  @"http://120.132.146.117/workroot/webservice/indexp.php?gtype=http"
//#define ELJavaLiveSeviceURL  @"https://zhibotest.yl1001.com/webservice/live_video/index.jsp/v1/sys/open/index"//直播测试/本地鉴权服务器环境
//#define ELJavaWebSeviceURL  @"https://producttest.yl1001.com/api-occupation/open/index" //微服务框架

//预发布
//#define SeviceURL  @"http://120.132.146.118/webservice/index.php?gtype=http"
//#define NewSeviceURL  @"http://120.132.146.118/workroot/webservice/indexp.php?gtype=http"
//#define ELJavaLiveSeviceURL  @"https://api4.yl1001.com/webservice/live_video/index.jsp/v1/sys/open/index"//直播测试/本地鉴权服务器环境
//#define ELJavaWebSeviceURL  @"https://productpre.yl1001.com/api-occupation/open/index" //微服务框架


// 正式环境
//#define SeviceURL  @"https://api1.yl1001.com/server/api/api.php/des/index"
#define SeviceURL  @"https://api.yl1001.com/webservice/index.php?gtype=http"
#define NewSeviceURL  @"https://api4.yl1001.com/workroot/webservice/indexp.php?gtype=http"
#define ELJavaLiveSeviceURL  @"https://api4.yl1001.com/webservice/live_video/index.jsp/v1/sys/open/index" // 直播
#define ELJavaWebSeviceURL  @"https://product.yl1001.com/api-occupation/open/index" //微服务框架
                                

// 辅助测试功能（接口调试和快捷登录账号显示）
#define isDebugFunc                        0  // * 注 *  release(发布) = 0 , debug（测试） = 1

//保利威直播 ----测试环境
//#define PolyvAppID_EL               @"ga9ev9muu3"
//#define PolyvAppSecret_EL           @"25622169afe34ccb929f1c490f13d4d7"
//#define PolyvUserId_EL              @"219e31f09b"

//保利威直播 ---  正式环境
#define PolyvAppID_EL               @"g97w676jnp"
#define PolyvAppSecret_EL           @"87d645676741439786b20c3a1c4b4b69"
#define PolyvUserId_EL              @"48ba55364b"
#define APIDUBUG 0 //API text


#else



// 正式环境
#define SeviceURL  @"https://api.yl1001.com/webservice/index.php?gtype=http" // 正式环境
#define NewSeviceURL  @"https://api4.yl1001.com/workroot/webservice/indexp.php?gtype=http"//正式环境
#define ELJavaLiveSeviceURL  @"https://api4.yl1001.com/webservice/live_video/index.jsp/v1/sys/open/index"
#define ELJavaWebSeviceURL  @"https://product.yl1001.com/api-occupation/open/index" //微服务框架
// 辅助测试功能
#define isDebugFunc                        0  // * 注 *  release(发布) = 0 , debug（测试） = 1 //网络请求错误打印地址和请求参数

//保利威直播
#define PolyvAppID_EL               @"g97w676jnp"
#define PolyvAppSecret_EL           @"87d645676741439786b20c3a1c4b4b69"
#define PolyvUserId_EL              @"48ba55364b"

#endif


#define New_Request_Version   @"v1"
// data.db 强制更新条件 AppData_HaveRewriteDataDB_V6_1_3

/*是否开放内购接口使用，需要保证线上的版本号与该版本不一样
 举例：当前已上线版本为v5.9.17,要上线5.9.18，该版本号为5.9.18
 若为小版本且接口版本号仍为5.9.17，则该版本号需改变，可以是5.9.17.1
 */

#define     Request_Version               @"v9.1.0"     // 网络请求所带版本号//后台允许的最大版本号

#define     Version_Show                  [NSString stringWithFormat:@"v%@",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]]   // APP内版本记录显示的版本 日稳定版带.Al
#define     App_Version                   [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]    // APP更新版本比较当前版本,不带vT1


// 上线前检查并修改 OutOfReviewDate（V7.0.1版本废弃）
#define     OutOfReviewDate               @"2020-09-27 18:00:00"    // 截屏、扫码功能启用时间//预估上线后开放的时间/第三方登录审核时屏蔽功能/企业端开放微信支付，一定是在苹果审核完成后的时间，建议三个工作日以后开放
// 双因子验证功能开关
#define     SafetyAuthSwitch                1   // 1=开启 ， 0 关闭
// 单点登录功能开关
#define     LoginKickedSwitch               1   // 1=开启 ， 0 关闭




/*
 //获取配置信息接口  此接口为get请求
 http://s2.job1001.com/webservice/app_info.php?key=
 //链接后直接拼接以下字段可获取返回值
 'debug'           => 'true', // 开发模式  编辑 删除
 'enableRecording' => 'true', // 开发模式下记录日志文件  编辑 删除
 'debugPerson'     => '["14035220","13995354"]', // 开发模式下可以看到日志文件的人  编辑 删除
 'versionCode'     => '191', // 一览版本号  编辑 删除
 'versionNamer'    => 'V5.9.20', // 编辑 删除
 'upload_url'      => 'http://file.yl1001.com/apk/yl_btn.apk', // 检测更新对应的下载地址  编辑 删除
 'register_sms'    => '0', // 手动注册-短信注册-是否显示 字符串1显示，其他隐藏
 'msgpush_type'    => '1', // 推送方式：1极光，2阿里云
 */









//********************* 系统版本号判断 ***************************
#define iOS11       [[[UIDevice currentDevice] systemVersion] floatValue] >= 11 ? YES : NO
#define iOSVerson   [[[UIDevice currentDevice] systemVersion] floatValue]

#define ELBundleID   [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]

#define ELAppleID @"468319885"

#define ELAppStoreUrl @"https://itunes.apple.com/cn/app/%E4%B8%80%E8%A7%88-%E6%B1%82%E8%81%8C%E6%8B%9B%E8%81%98%E6%89%BE%E5%B7%A5%E4%BD%9C%E7%9A%84%E4%BA%BA%E6%89%8D%E7%BD%91app/id468319885?mt=8"

//********************* 空数据判断 ***************************

// 判断字符串为空
//#define StringIsEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
#define StringIsEmpty(str) (![str isKindOfClass:[NSString class]] || str == nil || [str length] == 0 )

// 判断数组为空
//#define ArrayIsEmpty(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)
#define ArrayIsEmpty(array) (![array isKindOfClass:[NSArray class]] || array == nil || [array count] == 0)

// 判断字典为空
//#define DictIsEmpty(dic) (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys == 0)
#define DictIsEmpty(dic) (![dic isKindOfClass:[NSDictionary class]] || dic == nil || [[dic allKeys] count] == 0)

// 判断对象是空对象
#define ObjectIsEmpty(_object) (_object == nil || [_object isKindOfClass:[NSNull class]] || ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) || ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))


// 判断字符串不为空

#define StringIsNotEmpty(str) ([str isKindOfClass:[NSString class]] && str != nil && [str length] > 0 )

// 判断数组不为空

#define ArrayIsNotEmpty(array) ([array isKindOfClass:[NSArray class]] && array != nil && [array count] > 0)

// 判断字典不为空

#define DictIsNotEmpty(dic) ([dic isKindOfClass:[NSDictionary class]] && dic != nil && [[dic allKeys] count] > 0)

// 判断对象不为空
#define ObjectIsNotEmpty(_object) (_object != nil && ![_object isKindOfClass:[NSNull class]] && (![_object respondsToSelector:@selector(length)] && [(NSData *)_object length] != 0) && (![_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] != 0))




// 新的未知消息类型沙盒路径
#define IMNewMessageTypeDatasFilePath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES) objectAtIndex:0] stringByAppendingPathComponent:@"imNewMessageTypeDatas.plist"]


#define CurrentNavigation [UIWindow zf_currentViewController].navigationController

#define toast(message) [BaseUIViewController showAutoDismissFailView:nil msg:message seconds:1.0]

//storyboard
#define SbWorkBroker @"WorkBroker"
#define getCtlWithSb(sbName , ctlId) [[UIStoryboard storyboardWithName:sbName bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:ctlId]
#define HudShow [BaseUIViewController showLoadView:YES content:nil view:nil]
#define HudHide [BaseUIViewController showLoadView:NO content:nil view:nil]
#endif /* ELMacro_h */
